<#include "../common/header.html">
<body class="skin-blue fixed sidebar-mini" style="height: auto; min-height: 100%;">
<div class="wrapper" style="height: auto; min-height: 100%;">
    <#assign page_tab="order">
    <#include "order_menu.html">

    <!--左侧菜单 开始-->
    <aside id="admin_left" class="main-sidebar">
        <section class="sidebar" style="height: auto;">
            <div class="user-panel">
                <div class="pull-left image">
                    <i class="fa fa-user"></i>
                </div>
                <div class="pull-left info">
                    <p>admin</p>
                    <a href="#">超级管理员</a>
                </div>
            </div>

            <ul class="sidebar-menu tree" data-widget="tree">
                <li class="header">订单模块菜单</li>
                <li class="treeview">
                    <a href="#">
                        <i class="fa" name="ico" menu="订单管理"></i>
                        <span>订单管理</span>
                        <span class="pull-right-container">
								<i class="fa fa-angle-left pull-right"></i>
							</span>
                    </a>
                    <ul class="treeview-menu" name="leftMenu">
                        <li><a href="/order/order_list"><i class="fa fa-circle-o"></i>订单列表</a></li>
                        <li><a href="/order/order_edit"><i class="fa fa-circle-o"></i>添加订单</a></li>
                    </ul>
                </li>
                <li class="treeview">
                    <a href="#">
                        <i class="fa" name="ico" menu="单据管理"></i>
                        <span>单据管理</span>
                        <span class="pull-right-container">
								<i class="fa fa-angle-left pull-right"></i>
							</span>
                    </a>
                    <ul class="treeview-menu" name="leftMenu">
                        <li><a href="/order/order_collection_list"><i class="fa fa-circle-o"></i>收款单</a></li>
                        <li><a href="/order/order_refundment_list"><i class="fa fa-circle-o"></i>退款单</a></li>
                        <li><a href="/order/order_delivery_list"><i class="fa fa-circle-o"></i>发货单</a></li>
                        <li><a href="/order/refundment_list"><i class="fa fa-circle-o"></i>退款申请列表</a></li>
                    </ul>
                </li>
                <li class="treeview">
                    <a href="#">
                        <i class="fa" name="ico" menu="发货地址"></i>
                        <span>发货地址</span>
                        <span class="pull-right-container">
								<i class="fa fa-angle-left pull-right"></i>
							</span>
                    </a>
                    <ul class="treeview-menu" name="leftMenu">
                        <li><a href="/order/ship_info_list"><i class="fa fa-circle-o"></i>发货地址管理</a></li>
                    </ul>
                </li>

                <li class="header">快速导航</li>
                <li><a href="fdfdsf"><i class="fa fa-star-o"></i> <span>aaa</span></a></li>
            </ul>
        </section>
    </aside>
    <!--左侧菜单 结束-->

    <!--右侧内容 开始-->
    <div id="admin_right" class="content-wrapper">
        <script type="text/javascript" charset="UTF-8" src="/runtime/_systemjs/artTemplate/artTemplate.js"></script><script type="text/javascript" charset="UTF-8" src="/runtime/_systemjs/artTemplate/artTemplate-plugin.js"></script>
        <script type="text/javascript" charset="UTF-8" src="/runtime/_systemjs/areaSelect/areaSelect.js"></script>
        <div class="breadcrumbs" id="breadcrumbs">
            <ul class="breadcrumb">
                <li>
                    <i class="home-icon fa fa-home"></i>
                    <a href="#">订单</a>
                </li>
                <li>
                    <a href="#">订单管理</a>
                </li>
                <li class="active">订单编辑</li>
            </ul>
        </div>

        <div class="content">
            <form name="ModelForm" action="/order/order_update" method="post">
                <input type='hidden' name='id' value='' />
                <input type='hidden' name='takeself' value='' />

                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                        <li class="active">
                            <a href="#tab1" data-toggle="tab">商品信息</a>
                        </li>
                        <li>
                            <a href="#tab2" data-toggle="tab">订单配置</a>
                        </li>
                        <li>
                            <a href="#tab3" data-toggle="tab">收货人信息</a>
                        </li>
                    </ul>
                </div>

                <div class="tab-content">

                    <!--商品信息-->
                    <div class="tab-pane active" id="tab1">
                        <table class="table list-table">
                            <colgroup>
                                <col />
                                <col width="120px" />
                                <col width="100px" />
                                <col width="120px" />
                            </colgroup>

                            <thead>
                            <tr>
                                <th>商品名称</th>
                                <th>商品价格</th>
                                <th>商品数量</th>
                                <th>操作</th>
                            </tr>
                            </thead>

                            <tbody id="goodsBox"></tbody>
                            <tfoot>
                            <tr>
                                <td colspan="4">
                                    <a class="btn btn-default" href='javascript:searchGoods({"callback":searchGoodsCallback,"type":"checkbox","is_products":1});'>
                                        <i class='fa fa-plus'></i>添加商品
                                    </a>
                                </td>
                            </tr>
                            </tfoot>

                            <!--商品模板-->
                            <script type='text/html' id='goodsTrTemplate'>
                                <tr>
                                    <input type='hidden' name='goods_id[]' value='<%=item.id%>' />
                                    <input type='hidden' name='product_id[]' value='<%=item.product_id%>' />
                                    <td>
                                        <%=item.name?item.name:"商品不存在"%>
                                        <%if(item.spec_array){%>
                                        <span class="text-orange">
							<%var spec_array = typeof item.spec_array == 'string' ? JSON().parse(item.spec_array) : item.spec_array;%>
							<%for(var index in spec_array){%>
								<%var value = spec_array[index]%>
								<%=value['name']%>:
								<%if(value['type'] == 1){%>
									<%=value['value']%>
								<%}else{%>
									<img src="/<%=value['value']%>" width="35px" height="35px" />
								<%}%>
							<%}%>
							</span>
                                        <%}%>
                                        <%if(item.products_no){%>
                                        【<%=item.products_no%>】
                                        <%}%>

                                        <%if(item.goods_no){%>
                                        【<%=item.goods_no%>】
                                        <%}%>
                                    </td>
                                    <td><%=item.real_price%></td>
                                    <td><input class="form-control" name="goods_nums[]" value="<%=item.goods_nums ? item.goods_nums : 1%>" /></td>
                                    <td>
                                        <a onclick="$(this).parent().parent().remove();">
                                            <i class='operator fa fa-close'></i>
                                        </a>
                                    </td>
                                </tr>
                            </script>
                        </table>
                    </div>

                    <!--订单配置-->
                    <div class="tab-pane" id="tab2">
                        <table class="table form-table">
                            <colgroup>
                                <col width="130px" />
                                <col />
                            </colgroup>

                            <tbody>
                            <tr>
                                <th>配送方式：</th>
                                <td>
                                    <select name="distribution" alt="请选择配送方式" class="form-control" onchange="selectTakeself(this);">
                                        <option value="1" datatype="0">快递</option>
                                        <option value="2" datatype="1">货到付款</option>
                                    </select>
                                    <p id="takeself"></p>

                                    <!--自提点模板-->
                                    <script type='text/html' id='takeselfTemplate'>
                                        <%=item['province_str']%> <%=item['city_str']%> <%=item['area_str']%> <%=item['address']%> <%=item['name']%> <%=item['phone']%> <%=item['mobile']%>
                                    </script>
                                </td>
                            </tr>
                            <tr>
                                <th>配送运费：</th>
                                <td>
                                    <input class="form-control" type="text" name="real_freight" value="" pattern="float" empty />
                                    <p class="help-block">不填写运费则系统自动计算</p>
                                </td>
                            </tr>
                            <tr>
                                <th>支付方式：</th>
                                <td>
                                    <select name="pay_type" pattern="required" alt="请选择配送方式" class="form-control">
                                        <option value="">请选择支付</option>
                                        <option value="1">预存款</option>
                                        <option value="8">支付宝即时到帐</option>
                                        <option value="10">微信公众账号支付</option>
                                        <option value="11">微信二维码支付</option>
                                        <option value="13">支付宝手机网站支付</option>
                                        <option value="15">微信APP支付</option>
                                        <option value="16">微信H5支付</option>
                                        <option value="17">微信小程序支付</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <th>是否要发票：</th>
                                <td>
                                    <label class='checkbox-inline'>
                                        <input type="checkbox" name="invoice" value="1" onchange="$('#taxArea').toggle();" />发票
                                    </label>
                                </td>
                            </tr>
                            <tr id="taxArea" style="display:none;">
                                <th>发票信息：</th>
                                <td>
                                    <table class="table">
                                        <tr>
                                            <td>公司名称：<input class="form-control" type="text" name="invoice_company_name" value="" /></td>
                                            <td>纳税人识别码：<input class="form-control" type="text" name="invoice_taxcode" value="" /></td>
                                        </tr>

                                        <tr>
                                            <td>注册地址：<input class="form-control" type="text" name="invoice_address" value="" /></td>
                                            <td>注册电话：<input class="form-control" type="text" name="invoice_telphone" value="" /></td>
                                        </tr>

                                        <tr>
                                            <td>开户银行：<input class="form-control" type="text" name="invoice_bankname" value="" /></td>
                                            <td>银行账号：<input class="form-control" type="text" name="invoice_bankno" value="" /></td>
                                        </tr>

                                        <tr>
                                            <td>
                                                发票类型：
                                                <select name="invoice_type" class="form-control">
                                                    <option value="1">普通发票</option>
                                                    <option value="2">增值税专用票</option>
                                                </select>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <th>订单备注：</th>
                                <td>
                                    <input class="form-control" type="text" name="note" value="" />
                                </td>
                            </tr>
                            <tr>
                                <th>指定送货时间：</th>
                                <td>
                                    <label class='radio-inline'>
                                        <input type='radio' name='accept_time' checked="checked" value='任意' />任意
                                    </label>
                                    <label class='radio-inline'>
                                        <input type='radio' name='accept_time' value='周一到周五' />周一到周五
                                    </label>
                                    <label class='radio-inline'>
                                        <input type='radio' name='accept_time' value='周末' />周末
                                    </label>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>

                    <!--收货人信息-->
                    <div class="tab-pane" id="tab3">
                        <table class="table form-table">
                            <colgroup>
                                <col width="130px" />
                                <col />
                            </colgroup>

                            <tbody>
                            <tr>
                                <th>所属用户名:</th>
                                <td>
                                    <input type='text' name='username' value='' class='form-control' placeholder="用户注册名" />
                                    <p class="help-block">订单所属于的用户，直接填写用户名，订单创建后与该用户绑定在一起，如果为空则为游客订单或者线下订单</p>
                                </td>
                            </tr>
                            <tr>
                                <th>收货人姓名:</th>
                                <td>
                                    <input class="form-control" type="text" name="accept_name" value="" pattern="required" placeholder="请填写收货人姓名" />
                                </td>
                            </tr>
                            <tr>
                                <th>收货地区:</th>
                                <td>
                                    <div class="row">
                                        <div class="col-xs-3">
                                            <select name="province" child="city,area" class="form-control"></select>
                                        </div>
                                        <div class="col-xs-3">
                                            <select name="city" child="area" class="form-control"></select>
                                        </div>
                                        <div class="col-xs-3">
                                            <select name="area" pattern="required" class="form-control"></select>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <th>收货地址:</th>
                                <td>
                                    <input class="form-control" type="text" name="address" pattern="required" value="" placeholder="请填写收货地址" />
                                </td>
                            </tr>
                            <tr>
                                <th>联系手机:</th>
                                <td>
                                    <input class="form-control" type="text" name="mobile" value="" pattern="mobi" placeholder="填写手机号码" />
                                </td>
                            </tr>
                            <tr>
                                <th>联系电话:</th>
                                <td>
                                    <input class="form-control" type="text" name="telphone" value="" empty pattern="phone" placeholder="请输入正确的固定电话" />
                                </td>
                            </tr>
                            <tr>
                                <th>邮编:</th>
                                <td>
                                    <input class="form-control" type="text" name="postcode" value="" empty pattern="zip" placeholder="请输入正确的邮编" />
                                </td>
                            </tr>
                            <tr>
                                <th>用户附言:</th>
                                <td>
                                    <textarea class="form-control" rows="5" cols="15" name="postscript" placeholder="填写用户的附言"></textarea>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>

                    <div class="text-center">
                        <button class='btn btn-primary' type="submit">保 存</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <!--右侧内容 结束-->
</div>
</body>
</html>